Allow filter-only KQL custom rule exports#6253
Conversation
|
Reopened this as a clean replacement for #6180 after the old PR ref stopped updating cleanly. Local validation passed:
The remaining failing add-comment workflow is label-gated. I tried to add bug, detections-as-code, and patch, but GitHub reports I do not have permission to add labels here. |
Enhancement - GuidelinesThese guidelines serve as a reminder set of considerations when addressing adding a feature to the code. Documentation and Context
Code Standards and Practices
Testing
Additional Checks
|
|
Testing importing, functions as expected.
Remote testing paths for pre-built and custom rules pass |
| @cached_property | ||
| def validator(self) -> QueryValidator | None: | ||
| if self.language == "kuery": | ||
| if not self.query.strip() and self.filters and CUSTOM_RULES_DIR: |
There was a problem hiding this comment.
This will work for validation, but if you try to run view-rule it will still fail because the dataclass type check happens first. It looks like for this to work we will also need to update the schema similar to this patch,
filter_only_schema_optional_query.patch
Example test rule (.txt extension needed for github upload, remove before use):
rule_filter_only_export.ndjson.txt
test_filer_only_rule.toml.txt
|
Thanks for testing this and adding the labels. I appreciate the validation on both the import path and the remote prebuilt/custom rule paths. |

Summary
Fixes #6167.
Tests